package com.itheima.pattern.command;

import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;

//具体命令类
public class OrderCommand implements Command{
    //持有接收者对象
    private SeniorChef seniorChef;
    private Order order;


    public OrderCommand(SeniorChef seniorChef,Order order){
        this.seniorChef=seniorChef;
        this.order=order;
    }

    @Override
    public void execute(){//执行命令
        System.out.println(order.getDiningTable()+"桌的订单：");
        Map<String, Integer> foodDic = order.getFoodDic();
        foodDic.forEach(new BiConsumer<String, Integer>() {
            @Override
            public void accept(String s, Integer integer) {
                seniorChef.makeFood(integer,s);
            }
        });

        System.out.println(order.getDiningTable()+"桌的菜全部制作完成");
    }
}
